//
//  NSObject+Listener.h
//
//  Created by 慧趣小歪 on 16/12/8.
//  Copyright © 2016年 小分队. All rights reserved.
//

#import <Foundation/NSObject.h>

@interface Listener : NSObject

@property (nonatomic, readonly) dispatch_block_t nilDataSourceOnRelease;

@property (nonatomic, readonly) dispatch_block_t nothingOnRelease;

@end

@interface NSObject (Listener)

- (void)cleanListeners;

- (Listener *)listen:(NSObject *)obj forKey:(SEL)key onChanged:(SEL)callback;
- (Listener *)listen:(NSObject *)obj forKey:(SEL)key withOptions:(NSKeyValueObservingOptions)options onChanged:(SEL)callback;

- (Listener *)listen:(NSObject *)obj forKeyPath:(NSString *)keyPath onChanged:(SEL)callback;
- (Listener *)listen:(NSObject *)obj forKeyPath:(NSString *)keyPath withOptions:(NSKeyValueObservingOptions)options onChanged:(SEL)callback;

@end
